<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta charset="utf-8" />
		<title>请求日志 | SW-X</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<link rel="shortcut icon " type="images/x-icon" href="https://www.sw-x.cn/favicon.ico">
		<link href="https://www.sw-x.cn/assets/css/bootstrap.min.css" id="bootstrap-stylesheet" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/css/icon.css" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/libs/datatables/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/libs/datatables/responsive.bootstrap4.css" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/css/app.min.css" rel="stylesheet" type="text/css" />
		<link href="https://www.sw-x.cn/assets/css/style.css" rel="stylesheet" type="text/css" />
		<script src="https://www.sw-x.cn/assets/js/vendor.min.js"></script>
		<script src="https://www.sw-x.cn/assets/libs/datatables/jquery.dataTables.min.js"></script>
		<script src="https://www.sw-x.cn/assets/libs/datatables/dataTables.bootstrap4.js"></script>
		<script src="https://www.sw-x.cn/assets/libs/datatables/dataTables.responsive.min.js"></script>
		<!-- Datatables init -->
		<script src="https://www.sw-x.cn/assets/js/datatables.init.js"></script>
        <script src="https://www.sw-x.cn/assets/js/iframe.js?v=3" type="text/javascript"></script>
	</head>
	<body data-sidebar="dark">
		<div id="wrapper">
			<!-- 頂部 -->
			<div class="navbar-custom">
				<ul class="list-unstyled topnav-menu float-right mb-0">
					<!-- 用戶資訊 -->
					<li class="dropdown notification-list">
						<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
							<span class="pro-user-name ml-1"> 管理 <i class="mdi mdi-chevron-down"></i></span>
						</a>
						<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
							<!-- item-->
							<a href="javascript:out();" class="dropdown-item notify-item">
								<i class="fe-log-out"></i>
								<span>登出</span>
							</a>
						</div>
					</li>
				</ul>
				<!-- LOGO -->
				<div class="logo-box">
					<a href="/HttpMonitor/index" class="logo logo-light text-center"> 监控中心 </a>
				</div>
				<ul class="list-unstyled topnav-menu topnav-menu-left mb-0">
					<li>
						<button class="button-menu-mobile disable-btn waves-effect">
							<i class="fe-menu"></i>
						</button>
					</li>
					<li>
						<h4 class="page-title-main"> 请求日志 </h4>
					</li>
				</ul>
			</div>
			<!-- 側邊欄 -->
			<div class="left-side-menu">
				<div class="slimscroll-menu">
					<div id="sidebar-menu">
						<ul class="metismenu" id="side-menu">
							<li>
								<a href="/HttpMonitor/index">
									<i class="iconfont iconhome"></i>
									<span> 请求日志 </span>
								</a>
							</li>
						</ul>
					</div>
					<div class="clearfix"></div>
				</div>
			</div>
			
			<div class="content-page">
			    <div class="content">
					<div class="container-fluid">
						<div class="row">
							<div class="col-12">
								<div class="card-box">
									<div class="row">
										<div class="col-12">
											<div class="filter-list">
												<form  action="">
												<div class="row">
													<div class="col-md-2 col-xs-6">
														<label>请求状态：</label>
														<select class="form-control" name="status">
															<option value="">全部</option>
                                                            <option value="1" {if (!empty($param['status']) && $param['status'] == 1)} selected{/if}>进行中</option>
                                                            <option value="2" {if (!empty($param['status']) && $param['status'] == 2)} selected{/if}>已结束</option>
														</select>
													</div>
													<div class="col-md-2 col-xs-6">
														<label>路由地址</label>
														<input type="text" class="form-control" name="route" value="{$param.route|default=''}">
													</div>
													<div class="col-md-2 col-xs-6">
														<label>记录日期(只到天)</label>
														<input type="text" class="form-control" name="date" value="{$param.date|default=''}">
													</div>
													<div class="col-md-2 col-xs-12">
														<label style="color: #FFF;">1</label>
														<div>
															<button class="btn btn-primary waves-effect waves-light btn-sm"> 查詢 </button>
														</div>
													</div>
												</div>
												</form>
											</div>
											<div style="margin-top: 20px;">
												<div class="responsive-table-plugin">
													<div class="table-rep-plugin">
														<div class="table-responsive">
															<table id="datatable" class="table table-bordered dt-responsive nowrap">
																<thead>
																	<tr>
																		<th>fd</th>
																		<th>请求时间</th>
																		<th>结束时间</th>
																		<th>状态</th>
																		<th>请求类型</th>
																		<th>请求协议</th>
																		<th>路由</th>
																		<th>是否报错</th>
																		<th>操作</th>
																	</tr>
																</thead>
																<tbody>
                                                                    {foreach $list as $v}
																	<tr>
																		<td>{$v.fd}</td>
                                                                        <td>{$v.start_time}</td>
                                                                        <td>{$v.end_time|default=''}</td>
                                                                        <td>{if ($v.status==1)}<font color="red">进行中</font>{else /}已结束{/if}</td>
                                                                        <td>{$v.request_method}</td>
                                                                        <td>{$v.server_protocol}</td>
                                                                        <td>{$v.route}</td>
                                                                        <td>{if ($v.is_error==1)}<font color="red">是</font>{else /}否{/if}</td>
																		<td>
																			<button type="button" class="btn btn-primary waves-effect waves-light btn-sm" style="padding: 2px 10px;" onclick="ajaxs('{$v.file}')">详情</button>
																		</td>
																	</tr>
																	{/foreach}
																</tbody>
															</table>
														</div>
													</div>
												</div>
											</div>
											<div class="row">
												<div class="col-sm-12 col-md-12">
												    <div class="dataTables_paginate paging_simple_numbers">
												        {$page|raw}
												    </div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			
                <!-- 底部 -->
    			<footer class="footer">
    				<div class="container-fluid">
    					<div class="row">
    						<div class="col-md-12"> 由 <a href="https://www.sw-x.cn" target="_blank">sw-x</a> 高性能企业级PHP框架 | 提供技术支持 </div>
    					</div>
    				</div>
    			</footer>
		    </div>
	    </div>
		
	</body>
</html>
<script>
function out() {
    if (confirm('你确认退出吗?')) {
        $.ajax({
            type: 'get',
            data: {
            },
            url: "/HttpMonitor/out",
            success: function(data) {
                var array = eval('('+data+')');
                if (array['code'] == '00') {
                    dialog(array['msg'], 'success');
                    setTimeout(function() {
    					window.location.href = '/HttpMonitor/login'
    				}, 800);
                } else {
                    dialog(array['msg'], 'error');
                }
            }
        });
    }
}
function ajaxs(file) {
    iframe.createIframe('详情', '/HttpMonitor/details?file='+file, {
        'width':'1180px',
        'height':'600px',
        'footer':'none' // 设置不要点击按钮
    })
}
</script>			